import { stringify } from 'qs';
import request from '@/utils/request';

import webpath from '@/utils/webpath';

export async function deleteByPrimaryKeyForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/delete?${stringify(params)}`);
}


export async function selectByPrimaryKeyForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/get?${stringify(params)}`);
}


export async function insertForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateByMapForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}



export async function getAllForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function queryPageForProUser(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/prouser/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function countForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function deleteBatchForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateBatchForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getProDeptTreeByLevelCode(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/getProDeptTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function getProOrgTreeByParentid(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/getProOrgTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllAuthForUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/getAllAuthForUser`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}









export async function getProDeptTreeByParentid(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/getProDeptTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllPostForUser(params = {}) {
    return request(`/${webpath}/web/api/service/post/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function getAllChildren(params = {}) {
    return request(`/${webpath}/web/api/service/prodictionaryschildren/getAllChildren`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertForStaff(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/insert`, {
        method: 'POST',
        data: params.formdata
    });
}

export async function updateForStaffBaseInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/updatePersonNew`, {
        method: 'POST',
				data: params.formdata
    });
}

export async function updateForStaffContactInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersoncommunicationinformation/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function updateForStaffAccountInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/propersonaccountinformation/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function insertForStaffEducationInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonEducationalExperience/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function updateForStaffEducationInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonEducationalExperience/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function deleteForStaffEducationInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonEducationalExperience/delete?${stringify(params)}`);
}

export async function insertForStaffWorkInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonWorkExperience/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function updateForStaffWorkInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonWorkExperience/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function deleteForStaffWorkInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonWorkExperience/delete?${stringify(params)}`);
}

export async function insertForStaffTrainInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonTraining/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function updateForStaffTrainInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonTraining/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function deleteForStaffTrainInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersonTraining/delete?${stringify(params)}`);
}

export async function insertForStaffCertificateInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersoncertificate/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function updateForStaffCertificateInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersoncertificate/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function deleteForStaffCertificateInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/proPersoncertificate/delete?${stringify(params)}`);
}

export async function deleteByPrimaryKeyForProStaff(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/delete?${stringify(params)}`);
}

export async function queryPageForProStaff(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function getAllStaffInfo(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/getAllPersonInformation`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function upLoadListPersonInformation(params = {}) {
    return request(`/hrpersonmamagement/web/api/service/personinformation/upLoadListPersonInformation`, {
        method: 'POST',
        data: {
        	...params,
          method: 'insert',
        },
    });
}
